﻿@* TypeVisibility: Internal *@
@model BarIndexViewModel
@{
	var previewImage = Model.PreviewMode ? "preview-on.jpg" : "preview-off.jpg";
	var publishUrl = Model.HasContentItem() && Model.ContentItem.CanPublish ? Model.ContentItem.PublishUrl : "#";
	var publishImage = Model.HasContentItem() && Model.ContentItem.CanPublish ? "publish-on.jpg" : "publish-off.jpg";
	var editUrl = Model.HasContentItem() && Model.ContentItem.CanEdit ? Model.ContentItem.EditUrl : "#";
	var editImage = Model.HasContentItem() && Model.ContentItem.CanEdit ? "edit-on.jpg" : "edit-off.jpg";
}
<div id="adminBar">
	<div class="left">
		@if (Model.ShowLogo) { 
			@Html.StaticImage("slamcmslogo.jpg", "SlamCMS logo", new { @class = "logo" })
		}
		<ul class="nav">
			<li><a href="@Model.AdminUrl">Admin</a></li>
		</ul>
	</div>
	@if (Model.HasContentItem() && Model.ContentItem.ShowExpirationBox) { 
		<div class="center">
			<div class="expiration">
				<label>@Model.ContentItem.ExpirationMessage <span class="@(Model.ContentItem.Expired ? "expired" : "")">@Model.ContentItem.ExpirationDate.ToShortDateString()</span></label>
				@if (Model.ContentItem.CanVerify) { 
					<a href="@Url.Action("Verify", "ContentManagement", new { area = "_admin", contentItemId = Model.ContentItem.ContentItemId })" class="verify">Verify</a>
				}
				@if (Model.ContentItem.CanRetire) {
					<a href="@Url.Action("Retire", "ContentManagement", new { area = "_admin", contentItemId = Model.ContentItem.ContentItemId })" class="retire">Retire</a>
				}
			</div>
		</div>
	}
	<div class="right">
		@if (Model.HasContentItem()) {
			if (Model.HasContentItem() && Model.ContentItem.IsDraft) { 
				<a href="#" class="draft">@Html.StaticImage("draft.jpg", "Draft")</a>
			}
			@*<a href="@publishUrl">@Html.StaticImage(publishImage, "Publish")</a>*@
		}
		<a href="@Url.Action("TogglePreviewMode", "Bar", new { area = "_admin" })">@Html.StaticImage(previewImage, "Preview")</a>
		@if (Model.HasContentItem()) {
			<a href="@editUrl">@Html.StaticImage(editImage, "Edit")</a>
			if (Model.ContentItem.MenuItems.Any()) {
				<div class="menu">
					<a href="#">@Html.StaticImage("arrowbutton.jpg", "More")</a>
					<ul class="menu-box">
					@foreach (var menuItem in Model.ContentItem.MenuItems.Values) {
						<li><a id="@menuItem.Id" href="@(menuItem.Url ?? "javascript:void(0);")">@menuItem.Text</a></li>
					}
					</ul>
				</div>
			}
		}
		<a href="@Url.Action("Close", "Bar", new { area = "_admin" })" class="close">@Html.StaticImage("xbox.jpg", "Close")</a>
	</div>
</div>
